import 'package:fluro/fluro.dart';
import 'package:hospitable_rental/routes/route_handlers.dart';

class Routes {
  // 1. 定义路由名称
  static const home = "/";
  static const login = "/login";
  static const register = "/register";
  static const notFound = "/notFound";

  static const roomDetail = "/roomDetail";

  static const setting = "/setting";
  static const roomsManage = "/roomsManage";
  static const roomPublish = "/roomPublish";

  // 3. 编写函数 configureRoutes 关联路由名称和处理函数
  static void configureRoutes(FluroRouter router) {
    router.notFoundHandler = notFoundHandler;
    router.define(home, handler: homeHandler, transitionType: TransitionType.inFromRight);
    router.define(login, handler: loginHandler, transitionType: TransitionType.materialFullScreenDialog);
    router.define(register, handler: registerHandler, transitionType: TransitionType.materialFullScreenDialog);
    router.define(roomDetail + "/:roomId", handler: roomDetailHandler, transitionType: TransitionType.native);
    router.define(setting, handler: settingHandler, transitionType: TransitionType.native);
    router.define(roomsManage, handler: roomsManageHandler, transitionType: TransitionType.native);
    router.define(roomPublish, handler: roomPublishHandler, transitionType: TransitionType.native);
  }
}
